import axios from '@/libs/api.request'
import {getFullUrl} from '../config'

let getUrl = getFullUrl('user')

//--------------------------------------GET
// 获取所有模块
export const listModule = () => {
  return axios.request({
    url: getUrl('/module'),
    method: 'GET'
  })
}


//--------------------------------------POST

// 添加模块
export const addModule = (module) => {
  return axios.request({
    url: getUrl('/module'),
    method: 'POST',
    data: module
  })
}


//--------------------------------------PATCH

// 更新模块
export const updateModule = (module) => {
  return axios.request({
    url: getUrl('/module'),
    method: 'PUT',
    data: module
  })
}

//--------------------------------------DELETE

// 删除模块
export const removeModule = (moduleId) => {
  return axios.request({
    url: getUrl('/module/' + moduleId),
    method: 'DELETE'
  })
}
